<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>

	<script src="./listFunction.js"></script>
	<script>

		//	返回递增的链表
		function solution(head) {
			if (head == null || !head) {
				console.log('传入链表为空');
				return null
			}

			let p = head.next
			let temp = null
			console.log(head);

			while ( p ) {
				if (p.data > p.next.data) {
					temp = p.next.next
					p.next = temp
				}
				p = p.next
			}
			
			return head
		}

		let arr = [1, 2, 4, 3, 8, 6]
		let arr1 = [1, 2, 1, 4, 4, 3, 8, 6]

		let list1 = new InitList()
		let list2 = new InitList()
		let list3 = new InitList()

		list1.createList(arr)
		list2.createList(arr1)
		// list3.createList()

		list1.displayElems()
		console.log(list3.isEmpty())

		// let res = solution(list2.head)
		// console.log('res', res);
		// console.log('list2', list2);
		// list2.displayElems()
		// list2.locateElem(8)

	</script>
</body>
</html>